{{! app/templates/components/login-form.hbs }}

<!-- 页面顶部的登录提示，只要控制显隐状态即可  -->
<div class="ns-box ns-bar ns-effect-exploader ns-type-notice ns-show {{if isShow 'showProcessTool' 'hiddenProcessTools'}}" id="login-tip" style="top: 45px;">
    <div class="ns-box-inner">
        {{#if errorMessage}}
        {{errorMessage}}
        {{/if}}
    </div>
    <span class="ns-close" {{action 'hideTipOnChange'}}></span>
</div>

<form {{action 'authenticate' on='submit'}} id="form-signin" class="form-signin">
  <section id="login-section">

    <div class="input-group col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4">

      {{input type="text" class="form-control" value=email name="email" placeholder="请输入登录邮箱"
        key-press="hideTipOnChange" id="emailId" aria-describedby="es"}}
      <span class="glyphicon glyphicon-envelope form-control-feedback" aria-hidden="true"></span>

    <!--
      <div class="input-group-addon"><i class="fa fa-user"></i></div>
      -->
    </div>
    <div class="input-group col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4">
      {{input type="password" class="form-control" value=password
        placeholder="请输入密码" key-press="hideTipOnChange" name="password" id="pwdlId" aria-describedby="pwd"}}
        <span class="glyphicon glyphicon-lock form-control-feedback" aria-hidden="true"></span>
      <!-- <div class="input-group-addon"><i class="fa fa-key"></i></div> -->
    </div>
  </section>
  <section class="controls col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4">
    <div class="checkbox check-transparent pull-left" style="padding-left: 10px;">
      <input type="checkbox" value="1" id="remember" checked>
      <label for="remember" class="remember">30天内记住我</label>
    </div>

  </section>

  <button class="btn btn-greensea col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4"
    type="submit" id="loginButton" disabled={{enabled}}>
    登录</button>
    <!--
    &nbsp;&nbsp;
    {{#link-to 'register'class="btn btn-slategray"}}创建新账号{{/link-to}}
    -->
</form>

<section class="member-register col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4 clear-pd-lr">
  {{#link-to 'register' class="pull-left"}}忘记密码？{{/link-to}}
  {{#link-to 'register' class="pull-right"}}注册账号{{/link-to}}
</section>

<section class="log-in col-md-4 col-xs-4 col-md-offset-4 col-xs-offset-4 clear-pd-lr" style="margin-top: 20px;">


<div class="widget-login mt30">
    <a href="#" {{action 'googleLogin'}} class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-google">
      <span class="icon-sn-google"></span>
      <strong class="visible-xs-inline">Google 账号</strong>
    </a>
    <a href="#" {{action 'githubLogin'}} class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-github">
      <span class="icon-sn-github"></span>
      <strong class="visible-xs-inline">Github 账号</strong>
    </a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weibo" onclick="return tip()"><span class="icon-sn-weibo"></span> <strong class="visible-xs-inline">新浪微博账号</strong></a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-qq" onclick="return tip()"><span class="icon-sn-qq"></span> <strong class="visible-xs-inline">QQ 账号</strong></a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-wechat" onclick="return tip()"><span class="icon-sn-wechat"></span> <strong class="visible-xs-inline">微信账号</strong></a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-twitter btn-sm" onclick="return tip()"><span class="icon-sn-twitter"></span> <strong class="visible-xs-inline">Twitter 账号</strong></a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-facebook btn-sm" onclick="return tip()"><span class="icon-sn-facebook"></span> <strong class="visible-xs-inline">Facebook 账号</strong></a>
    <a href="#" class="btn pl5 pr5 mb5 btn-default btn-sn-douban btn-sm" onclick="return tip()"><span class="icon-sn-douban"></span> <strong class="visible-xs-inline">豆瓣账号</strong></a>
</div>

<!--
 <button class="btn btn-slategray pull-left">新浪微博登录</button>&nbsp;&nbsp;
 <button class="btn btn-slategray">QQ登录</button>&nbsp;&nbsp;
 <button class="btn btn-slategray pull-right">Github登录</button>
-->

</section>
<script>
function tip() {
    alert("功能正在加班开发中，请稍等时日！");
    return false;
}
// just for the demos, avoids form submit
// jQuery.validator.setDefaults({
//   debug: true
// });
$("#form-signin").validate({
  rules: {
    email: {
          required: true,
          email: true
      },
    password: {
      required: true,
      minlength: 6,
      maxlength: 16
    }
  },
  messages: {
    email: {
        required: "请输入邮箱地址",
        email: "请输入正确的邮箱地址"
    },
    password: {
      required: "请输入密码",
      minlength: "密码长度不少于6位",
      maxlength: "密码长度不能超过16位"
    }
  }
});

var loginFormDivHeight = $("#loginFormDiv").css("height").replace("px", ""); //css("height")这样获取的是 数字加px
$("#loginFormDiv").css({
    "margin-top": ($(document).height() - loginFormDivHeight) / 2
});
</script>
